<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>无标题文档</title>
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <link href="css/select.css" rel="stylesheet" type="text/css"/>
    <link href="/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/select-ui.min.js"></script>
    <script type="text/javascript" src="/layui/layui.js"></script>
</head>
<script type="text/javascript">

    $(document).ready(function (e) {
        $(".select3").uedSelect({
            width: 100
        });
    });

    layui.use('layer', function () {
        var layer = layui.layer;
    });

    function back(id) {
        layer.prompt({
            formType: 2,
            title: '请输入回复内容',
            area: ['450px', '200px'] //自定义文本域宽高
        }, function (content, index) {
            $.post("/returnFeedbacklist", {"id": id, "content": content}, function (data) {
                if (data == 1) {
                    layer.msg("成功回复！");
                    layer.close(index);
                    var id = setTimeout(function () {
                        location.reload();
                        clearTimeout(id);
                    }, 1200);
                } else if (data != 1) {
                    layer.msg("回复失败");
                }

            })
        });
    }

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#begin'
            , theme: 'grid'
        });
        laydate.render({
            elem: '#end'
            , theme: 'grid'
        });
    });

    function goToPage(pageNum) {
        var url = "/getFeedbacklist?pageNum=" + pageNum;
        $("#select").attr("action", url);
        $("#select").submit();
    }

    function createExcel() {
        var url = "/createExcel";
        $("#select").attr("action", url);
        $("#select").submit();
    }
</script>
<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">系统设置</a></li>
        <li><a href="#">反馈处理</a></li>
    </ul>
</div>
<div class="rightinfo">

    <form action="/getFeedbacklist" method="post" id="select">
        <ul class="seachform">
            <li><label>开始于</label><input id="begin" name="begin" type="text" class="scinput" value="${begin}"
                                         autocomplete="off"/></li>
            <li><label>结束于</label><input id="end" name="end" type="text" class="scinput" value="${end}"
                                         autocomplete="off"/></li>
            <li><label>反馈类型</label>
                <div class="vocation">
                    <select class="select3" name="typeid">
                        <option value="" <c:if test="${typeid == null}">selected</c:if>>全部</option>
                        <option value="1" <c:if test="${typeid == 1}">selected</c:if>>游戏问题</option>
                        <option value="2" <c:if test="${typeid == 2}">selected</c:if>>房间问题</option>
                    </select>
                </div>
            </li>
            <li><label>是否回复</label>
                <div class="vocation">
                    <select class="select3" name="isreturn">
                        <option value="" <c:if test="${isreturn == null}">selected</c:if>>全部</option>
                        <option value="2" <c:if test="${isreturn == 2}">selected</c:if>>已回复</option>
                        <option value="1" <c:if test="${isreturn == 1}">selected</c:if>>未回复</option>
                    </select>
                </div>
            </li>
            <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
        </ul>
    </form>
    <div class="tools">
        <ul class="toolbar1">
            <li onclick="createExcel()"><span><img src="images/t05.png"/></span>导出到excel表格</li>
        </ul>
    </div>
    <table class="tablelist">
        <thead>
        <tr>
            <th>反馈类型<i class="sort"><img src="images/px.gif"/></i></th>
            <th>反馈内容</th>
            <th>反馈用户</th>
            <th>反馈时间</th>
            <th>处理状态</th>
            <th>回复内容</th>
            <th>回复人</th>
            <th>处理时间</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${feedbackPageInfo.list}" var="temp1">
            <tr>
                <td>${temp1.feedbacktypename}</td>
                <td>${temp1.content}</td>
                <td>${temp1.username}</td>
                <td>${temp1.time}</td>
                <td>
                    <c:if test="${temp1.isreturn == 1}">
                        未处理&nbsp;&nbsp;<a href="#" class="tablelink" onclick="back(${temp1.id})">处理</a>
                    </c:if>
                    <c:if test="${temp1.isreturn != 1}">
                        已处理
                    </c:if>
                </td>
                <c:if test="${temp1.isreturn == 1}">
                    <td></td>
                    <td></td>
                    <td></td>
                </c:if>
                <c:if test="${temp1.isreturn != 1}">
                    <c:forEach items="${feedbackReturnList}" var="temp2">
                        <c:if test="${temp1.id == temp2.feedbackid}">
                            <td>${temp2.returncontent}</td>
                            <td>${temp2.username}</td>
                            <td>${temp2.returntime}</td>
                        </c:if>
                    </c:forEach>
                </c:if>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="pagin">
        <div class="message">共<i class="blue">${feedbackPageInfo.total}</i>条记录，当前显示第&nbsp;<i
                class="blue">${feedbackPageInfo.pageNum}&nbsp;</i>/&nbsp;<i
                class="blue">${feedbackPageInfo.pages}&nbsp;</i>页
        </div>
        <ul class="paginList">
            <li class="paginItem"><a onclick="goToPage(1)">首页</a></li>
            <c:choose>
                <c:when test="${feedbackPageInfo.pageNum > 1}">
                    <li class="paginItem"><a ONCLICK="goToPage(${feedbackPageInfo.pageNum - 1})">上一页</a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li class="paginItem"><a href="javascript:;">上一页</a></li>
                </c:otherwise>
            </c:choose>
            <c:choose>
                <c:when test="${feedbackPageInfo.pageNum < feedbackPageInfo.pages}">
                    <li class="paginItem"><a ONCLICK="goToPage(${feedbackPageInfo.pageNum + 1})">下一页</a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li class="paginItem"><a href="javascript:;">下一页</a></li>
                </c:otherwise>
            </c:choose>
            <li class="paginItem"><a ONCLICK="goToPage(${feedbackPageInfo.pages})">尾页</a></li>
        </ul>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
